<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--
  Created by IntelliJ IDEA.
  User: Lenovo
  Date: 2025/7/2
  Time: 10:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改直播信息</title>
    <style>
        body { font-family: Arial, sans-serif; margin: 20px; }
        h1 { color: #333; text-align: center; }
        form { max-width: 600px; margin: 0 auto; }
        .form-group { margin-bottom: 15px; }
        label { display: inline-block; width: 100px; vertical-align: top; }
        input, select {
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
        }
        .inline-group { display: flex; align-items: center; margin-bottom: 10px; }
        .inline-group input { margin-right: 10px; }

    </style>
</head>
<body>
<h1>修改直播带货列表</h1>
<form action="${pageContext.request.contextPath}/live/update2" method="post" onsubmit="return confirmSubmit()">
    <input type="hidden" name="id" value="${livecommerce.id}">
    <div class="from-group">
        <label>主播姓名</label>
        <input type="text" name="streamer" value="${livecommerce.streamer}" required>
    </div>
    <div class="from-group">
        <label>直播平台</label>
        <select name="livePlatform" required>
            <option value="">请选择</option>
            <option value="抖音" ${livecommerce.livePlatform=='抖音'? 'selected':''}>抖音</option>
            <option value="微信" ${livecommerce.livePlatform=='微信'? 'selected':''}>微信</option>
            <option value="快手" ${livecommerce.livePlatform=='快手'? 'selected':''}>快手</option>
        </select>
    </div>
    <div class="from-group">
        <label>带货商品</label>
        <div class="inline-group">
            <input type="text" name="product" value="${livecommerce.product}" required  placeholder="商品名称">
            <span>商品价格</span>
            <input type="number" name="price" value="${livecommerce.price}" required placeholder="0.00" step="0.01"
                   min="0">
        </div>
    </div>
    <div class="form-group">
        <label>直播时间</label>
        <input type="datetime-local" name="liveTime" required
               value="<fmt:formatDate value="${livecommerce.liveTime}" pattern="yyyy-MM-dd'T'HH:mm"/>">
    </div>
    <div class="form-group">
        <label>直播状态</label>
        <div>
            <label><input type="radio" name="status" value="1" ${livecommerce.status==1?'checked':''}>正常直播</label>
            <label><input type="radio" name="status" value="0" ${livecommerce.status==0?'checked':''}>取消直播</label>

        </div>
    </div>
    <div class="form-group">
        <button type="submit">修改</button>
        <a href="${pageContext.request.contextPath}/live/list">
            <button type="button">返回列表</button>
        </a>
    </div>
</form>
</body>
</html>
<script>
    function confirmSubmit(){
        return confirm("确认修改吗")
    }
</script>
